import { GLabel } from "../../../../com/mui/controls/GLabel";
import { GTextFormat } from "../../../common/GTextFormat";
import { FilterConst } from "../../../component/gconst/FilterConst";
import { FlyFootBmp } from "../mapUI/flyFoot/FlyFootBmp";
import { AIManager } from "../../scene/ai/AIManager";
import { AIType } from "../../scene/ai/AIType";
import { TaskTargetInfo } from "../../model/TaskTargetInfo";
//class TargetNPCSPrite
    
    export  class TargetNPCSPrite /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this._nameLabel = new GLabel();
            this._nameLabel.setStyle("textFormat", new GTextFormat(null, 12, 7352480, null, null, null, null, null, null, null, null, null, 5));
            this._nameLabel.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._nameLabel.filters = [FilterConst.nameGlowFilter];
            this._nameLabel.addEventListener(flash.events.TextEvent.LINK, this.onLinkTextClickHandler);
            this.addChild(this._nameLabel);
            this._flyBmp = new FlyFootBmp();
            this._flyBmp.addEventListener(flash.events.MouseEvent.CLICK, this.onFlyBmpClickHandler);
            this.addChild(this._flyBmp);
            return;
        }

        /* internal  */onFlyBmpClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            AIManager.onAIControl(this.data, AIType.AI_Convey);
            return;
        }

        /* internal  */onLinkTextClickHandler(arg1: Object /* flash.events.TextEvent */): void
        {
            AIManager.onAutoPathAIControl(this.data);
            return;
        }

        public get data(): TaskTargetInfo
        {
            return this._data;
        }

        public set data(arg1: TaskTargetInfo)
        {
            this._data = arg1;
            if (arg1) 
            {
                this._nameLabel.htmlText = "<a href=\'event: 1\'><font color=\'#f9ff5d\'><u>" + arg1.mapName + arg1.name + "</u></font></a>";
                this._nameLabel.drawNow();
            }
            this._flyBmp.x = this._nameLabel.x + this._nameLabel.textField.textWidth + 10;
            return;
        }

        /* internal */ /* var */_data: TaskTargetInfo;

        /* internal */ /* var */_bitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_nameLabel: GLabel;

        /* internal */ /* var */_flyBmp: FlyFootBmp;
    }
